$OpenBSD: patch-source_shared_lib_include_platform_sdl_platform_main_h,v 1.2 2015/04/06 12:49:52 stsp Exp $
Fix for i386 PIE (ebx is reserved).
--- source/shared_lib/include/platform/sdl/platform_main.h.orig	Mon Mar  9 00:09:09 2015
+++ source/shared_lib/include/platform/sdl/platform_main.h	Mon Apr  6 09:51:53 2015
@@ -597,9 +597,16 @@ int mainSetup(int argc, char **argv) {
 
 #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
 
+#if defined(__i386__) && defined(__PIE__)
 #define cpuid(func,ax,bx,cx,dx)\
+	__asm__ __volatile__ (\
+	"xchg %%ebx, %%esi; cpuid; xchg %%ebx, %%esi":\
+	"=a" (ax), "=S" (bx), "=c" (cx), "=d" (dx) : "a" (func));
+#else
+#define cpuid(func,ax,bx,cx,dx)\
 	__asm__ __volatile__ ("cpuid":\
 	"=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
+#endif
 
 	int ax=0,bx=0,cx=0,dx=0;
 	cpuid(0x0000001,ax,bx,cx,dx)
